package com.eicas.service.impl;

import com.eicas.Constant;
import com.eicas.JwtTokenManager;
import com.eicas.entity.User;
import com.eicas.mapper.UserMapper;
import com.eicas.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author: Administrator
 * @since: 2023/2/9 10:02
 * @description:
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private JwtTokenManager jwtTokenManager;
    @Autowired
    private UserMapper userMapper;

    @Override
    public boolean doLogin(User user) {
        return userMapper.validateUserInfo(user);
    }

    @Override
    public String createToken(String username) {
        return Constant.TOKEN_PREFIX + jwtTokenManager.createToken(username);
    }
}
